package com.situ.util.service.impl;
import java.util.List;

import com.situ.sal.entity.SalPlan;
import com.situ.sal.service.SalChanceService;
import com.situ.util.dto.CstSerSj;
import com.situ.util.entity.SysUser;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.situ.util.service.CstServiceService;
import com.situ.util.dao.CstServiceDao;
import com.situ.util.entity.CstService;
/**
 * CstService的服务接口的实现类
 * 
 * @author 胡文 qq:986776
 *
 */
@Service
public class CstServiceServiceImpl implements CstServiceService {
	private final Logger LOG = LogManager.getLogger(this.getClass());

	@Autowired
	private CstServiceDao cstServiceDao;

/**
* 查询....
*/
	@Override
	public List<CstService> find(CstService value) {

		List<CstService> result = cstServiceDao.selectCstServiceByObj(value);

		return result;
	}
    /**
* 根据id查询
*/
	@Override
	public CstService findOne(Integer id) {

		CstService result = cstServiceDao.selectCstServiceById(id);

		return result;
	}

/**
* 添加不为空
*/
	@Override
	public CstService saveNotNull(CstService value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行将CstService中属性值不为null的数据保存到数据库-->失败:对象不能为空");
			}
			return value;
		}
		if(value.getSvr_type() == null || value.getSvr_title() == null || value.getSvr_cust_name() == null || value.getSvr_status() == null || value.getSvr_request() == null || value.getSvr_create_id() == null || value.getSvr_create_by() == null || value.getSvr_create_date() == null  ){
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行将CstService中属性值不为null的数据保存到数据库-->失败:存在不能为空的空值");
			}
			return value;
		}
		int result = cstServiceDao.insertNotNullCstService(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行将CstService中属性值不为null的数据保存到数据库-->结果:", result);
		}
		return value;
	}
	@Override
    /**
* 修改不为空
*/
	public int updateNotNullById(CstService value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过CstService的id更新CstService中属性不为null的数据-->失败:对象为null");
			}
			return 0;
		}
		int result = cstServiceDao.updateNotNullCstServiceById(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过CstService的id更新CstService中属性不为null的数据-->结果:", result);
		}
		return result;
	}
    /**
* 删除
*/
	@Override
	public int deleteById(Integer id) {
		if (id == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过CstService的id删除CstService-->失败:id不能为空");
			}
			return 0;
		}
		int result = cstServiceDao.deleteCstServiceById(id);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过CstService的id删除CstService-->结果:", result);
		}
		return result;
	}

	@Override
	public void addServerFw(CstService cs) {
		cstServiceDao.addServerFw(cs);
	}


	@Override
	public List<CstService> queryServiceByLike(CstSerSj c) {
		return cstServiceDao.queryServiceByLike(c);
	}

	@Override
	public List<CstService> queryServiceByLike2(CstSerSj c) {
		return cstServiceDao.queryServiceByLike2(c);
	}


	public void deleteCstServiceById2(int id) {
        cstServiceDao.deleteCstServiceById2(id);
    }

	@Override
	public void updatesdt(CstService c) {
		cstServiceDao.updatesdt(c);
	}

	@Override
	public List<CstService> queryServiceByLikeFk(CstSerSj c) {
		return cstServiceDao.queryServiceByLikeFk(c);
	}

	@Override
	public CstService selectCstSerById(int id) {
		return cstServiceDao.selectCstSerById(id);
	}

	@Override
	public List<SysUser> queryusers() {
		return cstServiceDao.queryusers();
	}

	@Override
	public List<CstService> queryServiceByLikeGd(CstSerSj c) {
		return cstServiceDao.queryServiceByLikeGd(c);
	}

	@Override
	public void updateCs(CstService c) {
		cstServiceDao.updateCs(c);
	}

    @Override
    public void updateFk(CstService c) {
        cstServiceDao.updateFk(c);
    }

	@Override
	public void updateXxy3(CstService c) {
		cstServiceDao.updateXxy3(c);
	}

}